Skip to main content

All Questions

5votes
2answers
175views

LeetCode Number 416: Partition Equal Subset Sum

Problem: MLE I am confused as to why the LeetCode judge reports Memory Limit Exceeded when my solution looks close to the editorial solution. I not too familiar with ...
user430243's user avatar
7votes
4answers
942views

Project Euler #54: class for poker hands

I'm working right now on Project Euler problem 54, and I figured that this was the perfect opportunity to try to work with classes. This is my first time, so I'm sure that there are a lot of style, ...
Brais Romero's user avatar
6votes
2answers
232views

(HackerRank) Project Euler+ #250: 250250

Link to problem: linkNumber of solvers: 27 out of 844Solve rate (per person): 3.199%Success rate (over all submissions): 1.78% Project Euler+ on HackerRank is basically supposed to be a generalization ...
CrSb0001's user avatar
7votes
4answers
1kviews

LeetCode 977: Squares of a sorted array, maintaining non-decreasing order

I tried solving the LeetCode question like many others, trying to incorporate the O(n) time complexity requirement. Squares of a Sorted Array Given an integer array ...
Littlejacob2603's user avatar
11votes
4answers
2kviews

Leetcode 93: Restore IP Addresses

(Source: Leetcode 93: Restore IP Addresses [Medium])(Topics: [String] [Backtracking]) The problem is as follows: Definition: A valid IP address is defined to consist of exactly four integers ...
CrSb0001's user avatar
5votes
5answers
840views

Bracket matching - Advent of Code 2021 Day 10

The following code solves Advent Of Code 2021 Day 10. The goal for this time around is evaluating whether a line of brackets is complete, has a syntax error or is missing some closing brackets. ...
138 Aspen's user avatar
4votes
1answer
140views

Efficient polynomial multiplication in Python

I'm practicing problems for the ICPC competition, and one of the problems requires solving it by using an FFT to compute the product of two polynomials efficiently. Since this is for the ICPC ...
João Areias's user avatar
1vote
1answer
106views

Finding the number of distinct decompositions a number has using only repdigits

This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
Lesserrafim's user avatar
6votes
3answers
882views

Project Euler 127 - abc-hits

Problem (Rephrased from here): The radical of \$n\$, \$rad(n)\$, is the product of distinct prime factors of \$n\$. For example, \$504 = 2^3 × 3^2 × 7\$, so \$rad(504) = 2 × 3 × 7 = 42\$. We shall ...
Nadav Nevo's user avatar
2votes
1answer
50views

Optimal Extraction of Longest Sorted Sequence from Individually Sorted Bucket Arrays Without Repetitions

Consider a bucket array containing sorted and/or empty buckets, and the goal is to extract the longest possible sequence in sorted order, under the following conditions: Only one element in each ...
M.A.'s user avatar
  • 121
5votes
1answer
226views

Performance Tuning to enable answer for Project Euler #566 "Cake Icing Puzzle"

Related to this question I am still looking for a solution to Project Euler Problem 566 (see link for a nice simulation also): Adam plays the following game with his birthday cake. He cuts a piece ...
DuesserBaest's user avatar
5votes
2answers
351views

Coding challenge for mixing a string

Challenge at https://www.codewars.com/kata/5629db57620258aa9d000014/train/python Given two strings s1 and s2, we want to visualize how different the two strings are. We will only take into account ...
Vessel's user avatar
2votes
3answers
571views

Extract data from poorly formatted phonebook

The Problem John keeps a backup of his old personal phone book as a text file. On each line of the file he can find the phone number (formated as +X-abc-def-ghij where X stands for one or two digits),...
Vessel's user avatar
4votes
1answer
153views

Longest spell to cast from pages of spellbook follow-up

This question is from the PCTC 2022 R2 Past Paper and is a follow-up on my previous question. Previous question I have implemented several solutions suggested, such as creating an array with pages ...
helielicopter123's user avatar
6votes
4answers
596views

Longest spell to cast from pages of spellbook

While practicing for a school coding challenge, I came across this problem. My code got the right answers but exceeded the time limited. Any tips for how to reduce the time complexity? https://pctc....
helielicopter123's user avatar

153050per page
close